/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package module2.exercise2.version3;

/**
 *
 * @author trang
 */
public class Vehicle {
    private  double load; // input data is in newtons => output data is in Kg
    private  double maxLoad;// input data is in newtons => output data is in Kg


// building a constructor to set maxLoad attribute
    public Vehicle(double maxLoad) {
        this.maxLoad = maxLoad;
    }
// building method
    public double getLoad() {
        return newtsToKilo(load);

    }

    public double getMaxLoad() {
        return newtsToKilo(maxLoad);
}

    public boolean addBox(double weight){
        //load = 0;
        double currLoad;
        currLoad = load + weight;

        if (currLoad > maxLoad) {
            return false;

        } else {
            load = currLoad;
            return true;

        }
    }
    
    private double kiloTonewts(double weight){
        return (weight * 9.8);
    
    }
    // convert to newtons to kg
    private double newtsToKilo(double weight){
        return (weight / 9.8);
    
    }
}

